import Vue from 'vue'
import Router from 'vue-router'
// 导入刚才编写的组件
import AppIndex from '@/components/Home/AppIndex.vue'
import Login from '@/components/Login.vue'
import Regist from '@/components/Regist.vue'
import Information from '@/components/Home/Information.vue'
import History from '@/components/Home/History.vue'
import homePage from '../components/homePage'
import TaskList from '../components/Home/TaskList'
import ReadTask from '../components/Home/ReadTask'
import TaskInProgress from '../components/Home/TaskInProgress'
import MyRelease from '../components/Home/MyRelease'
import ReadTaskInProgress from '../components/Home/ReadTaskInExecution'
import MyFinishedTask from '../components/Home/MyFinishedTask'
import Complaint from '../components/Home/Complaint'
import Evaluation from '../components/Home/Evaluation'
import ChangePassword from '../components/Home/ChangePassword'
import ForgetPassword from '../components/ForgetPassword'
import AddTask from '../components/Home/AddTask'
import AdminLogin from '../components/AdminLogin'
import AdminIndex from '../components/Home/AdminIndex'
import ReportTask from '../components/Home/ReportTask'
import Debate from '../components/Home/Debate'
import Reports from '../components/Home/Reports'
import Debates from '../components/Home/Debates'
import Complaints from '../components/Home/Complaints'
Vue.use(Router)
// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/AdminLogin',
      name: 'AdminLogin',
      component: AdminLogin
    },
    {
      path: '/ForgetPassword',
      name: 'ForgetPassword',
      component: ForgetPassword
    },
    {
      path: '/index',
      name: 'AppIndex',
      component: AppIndex,
      children: [
        {
          path: '/Debate',
          name: 'Debate',
          component: Debate
        },
        {
          path: '/ReportTask',
          name: 'ReportTask',
          component: ReportTask
        },
        {
          path: '/AddTask',
          name: 'AddTask',
          component: AddTask
        },
        {
          path: '/ChangePassword',
          name: 'ChangePassword',
          component: ChangePassword
        },
        {
          path: '/Evaluation',
          name: 'Evaluation',
          component: Evaluation
        },
        {
          path: '/Complaint',
          name: 'Complaint',
          component: Complaint
        },
        {
          path: '/MyFinishedTask',
          name: 'MyFinishedTask',
          component: MyFinishedTask
        },
        {
          path: '/history',
          name: 'History',
          component: History
        },
        {
          path: '/Information',
          name: 'Information',
          component: Information
        },
        {
          path: '/TaskList',
          name: 'TaskList',
          component: TaskList
        },
        {
          path: '/ReadTask',
          name: 'ReadTask',
          component: ReadTask
        },
        {
          path: '/TaskInProgress',
          name: 'TaskInProgress',
          component: TaskInProgress
        },
        {
          path: '/MyRelease',
          name: 'MyRelease',
          component: MyRelease
        },
        {
          path: '/ReadTaskInProgress',
          name: 'ReadTaskInProgress',
          component: ReadTaskInProgress
        }
      ]
    },
    {
      path: '/AdminIndex',
      name: 'AdminIndex',
      component: AdminIndex,
      children: [
        {
          path: '/Complaints',
          name: 'Complaints',
          component: Complaints
        },
        {
          path: '/Debates',
          name: 'Debates',
          component: Debates
        },
        {
          path: '/Reports',
          name: 'Reports',
          component: Reports
        }
      ]
    },
    {
      path: '/regist',
      name: 'Regist',
      component: Regist,
      meta: {
        index: 1,
        showFooter: false
      }
    },
    {
      path: '/',
      name: 'homePage',
      component: homePage
    }
  ]
})
